﻿using SyncFileCommon.Class;
using SyncFileCommon.Model;

namespace SyncFileCommon.BLL
{
    public class UserBLL
    {
        public static List<UserModel> UserList = null;

        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <returns></returns>
        public static List<UserModel> UserListGet()
        {
            string _sUser = FileHelper.FileTextRead(FileHelper.GetRunPath() + "UserInfo");
            List<UserModel> _userList = JsonHelper.GetObjectFromJsonStr<List<UserModel>>(_sUser);
            UserList = _userList;
            return _userList;
        }

        /// <summary>
        /// 保存用户列表
        /// </summary>
        /// <param name="userList"></param>
        public static void UserListSave(List<UserModel> userList)
        {
            UserList = userList;
            string _sUserList = JsonHelper.GetJsonStrFromObject(userList);
            FileHelper.FileTextWrite(FileHelper.GetRunPath() + "UserInfo", _sUserList);
        }

    }
}
